/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.aptech.sBean;

import com.aptech.entities.TblUser;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author Winner
 */
@Stateless
public class TblUserFacade extends AbstractFacade<TblUser> {

    @PersistenceContext(unitName = "Elevation_System_Online-ejbPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public TblUserFacade() {
        super(TblUser.class);
    }
    
     public List<TblUser> checkLogin(String usUserName, String usPassword) {
        Query query = em.createNamedQuery("TblUser.checkLogin");        
        query.setParameter("usUserName", usUserName);
        query.setParameter("usPassword", usPassword);
        return query.getResultList();
    }
     
     public List<TblUser> getUserByID(int usID) {
        Query query = em.createNamedQuery("TblUser.findByUsID");
        query.setParameter("usID", usID);
        return query.getResultList();
    }
}
